/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pkl53.view;

import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Point;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import pkl53.model.B4Art;
import pkl53.model.B4Keteranganumumtenagakerja;

import pkl53.view.loop.Loop4A;

/**
 *
 * @author Ema Yulandika SP
 */
public class Blok4 extends javax.swing.JPanel {
    
    
    Loop4A loop;
    private String kks;
    private List <B4Keteranganumumtenagakerja> b4Keteranganumumlist= new ArrayList<B4Keteranganumumtenagakerja>();
    private List <B4Art> b4ArtList= new ArrayList<B4Art>();

    /**
     * Creates new form Blok4
     */
    public Blok4() {
//        scrollPane1.getViewport().setBackground( new Color(1.0f, 1.0f, 1.0f, 0.6f));
        initComponents();
        
        loop = new Loop4A();
        loopPanel.add(loop);
        
        String Art=loop.getB4ArtModel().getB4r1();
        String Nup=loop.getB4KeteranganumumtenagakerjaModel().getB4r4();
        
//        loop.getB4KeteranganumumtenagakerjaModel().setB4Art(null);
//        loop.getB4KeteranganumumtenagakerjaModel().setKKSArtNup(kks+Art+Nup);
        
        b4Keteranganumumlist.add(loop.getB4KeteranganumumtenagakerjaModel());
        
//        loop.getB4ArtModel().setKks(kks);
//        loop.getB4ArtModel().setKKSArt(kks+Art);
        b4ArtList.add(loop.getB4ArtModel());
        
        
        GridLayout grid = new GridLayout(20,1,0,0);
        loopPanel.setLayout(grid);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        blokPekerja41 = new pkl53.imageClass.BlokPekerja4();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jPanel1 = new javax.swing.JPanel();
        tambahArtButton = new javax.swing.JButton();
        tambahPekerjaanButton = new javax.swing.JButton();
        loopPanel = new javax.swing.JPanel();

        setPreferredSize(new java.awt.Dimension(2100, 1275));

        blokPekerja41.setPreferredSize(new java.awt.Dimension(2100, 1275));

        jLayeredPane1.setPreferredSize(new java.awt.Dimension(2100, 1275));
        jLayeredPane1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setBackground(new java.awt.Color(102, 102, 102));

        tambahArtButton.setText("Tambah Art");
        tambahArtButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahArtButtonActionPerformed(evt);
            }
        });

        tambahPekerjaanButton.setText("Tambah Pekerjaan");
        tambahPekerjaanButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahPekerjaanButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(1713, Short.MAX_VALUE)
                .addComponent(tambahPekerjaanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tambahArtButton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tambahArtButton)
                    .addComponent(tambahPekerjaanButton))
                .addContainerGap())
        );

        jLayeredPane1.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 430, 1987, 30));

        loopPanel.setOpaque(false);

        javax.swing.GroupLayout loopPanelLayout = new javax.swing.GroupLayout(loopPanel);
        loopPanel.setLayout(loopPanelLayout);
        loopPanelLayout.setHorizontalGroup(
            loopPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1990, Short.MAX_VALUE)
        );
        loopPanelLayout.setVerticalGroup(
            loopPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 436, Short.MAX_VALUE)
        );

        jLayeredPane1.add(loopPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(52, 460, 1990, -1));

        javax.swing.GroupLayout blokPekerja41Layout = new javax.swing.GroupLayout(blokPekerja41);
        blokPekerja41.setLayout(blokPekerja41Layout);
        blokPekerja41Layout.setHorizontalGroup(
            blokPekerja41Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(blokPekerja41Layout.createSequentialGroup()
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        blokPekerja41Layout.setVerticalGroup(
            blokPekerja41Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(blokPekerja41Layout.createSequentialGroup()
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(blokPekerja41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(blokPekerja41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void tambahArtButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahArtButtonActionPerformed
        // TODO add your handling code here:
         loop = new Loop4A();
         loopPanel.add(loop);
         
        String Art=loop.getB4ArtModel().getB4r1();
        String Nup=loop.getB4KeteranganumumtenagakerjaModel().getB4r4();
        
//        loop.getB4KeteranganumumtenagakerjaModel().setKKSArt(new B4Art(Art));
//        loop.getB4KeteranganumumtenagakerjaModel().setKKSArtNup(kks+Art+Nup);
        b4Keteranganumumlist.add(loop.getB4KeteranganumumtenagakerjaModel());
        
//        loop.getB4ArtModel().setKks(kks);
//        loop.getB4ArtModel().setKKSArt(kks+Art);
        b4ArtList.add(loop.getB4ArtModel());
         
         loop.getB4R1().requestFocusInWindow();
         loop.getB4R1().setBounds(loop.getB4R1().getBounds().x-25,loop.getB4R1().getBounds().y,loop.getB4R1().getBounds().width,loop.getB4R1().getBounds().height);
         loop.getB4R1().getPanel().scrollRectToVisible(loop.getB4R1().getBounds());
         
        
     
        
        
        
    }//GEN-LAST:event_tambahArtButtonActionPerformed

    private void tambahPekerjaanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahPekerjaanButtonActionPerformed
        // TODO add your handling code here:
        loop = new Loop4A();
         loopPanel.add(loop);
         
        String Art=loop.getB4ArtModel().getB4r1();
        String Nup=loop.getB4KeteranganumumtenagakerjaModel().getB4r4();
        
//        loop.getB4KeteranganumumtenagakerjaModel().setKKSArt(new B4Art(Art));
//        loop.getB4KeteranganumumtenagakerjaModel().setKKSArtNup(kks+Art+Nup);
        b4Keteranganumumlist.add(loop.getB4KeteranganumumtenagakerjaModel());
//        
//        loop.getB4ArtModel().setKks(kks);
        loop.getB4ArtModel().setKKSArt(kks+Art);
        b4ArtList.add(loop.getB4ArtModel());
         
         
         
         loop.getB4R1().requestFocusInWindow();
         loop.getB4R1().setBounds(loop.getB4R1().getBounds().x-25,loop.getB4R1().getBounds().y,loop.getB4R1().getBounds().width,loop.getB4R1().getBounds().height);
         loop.getB4R1().getPanel().scrollRectToVisible(loop.getB4R1().getBounds());
         
    
       
    }//GEN-LAST:event_tambahPekerjaanButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private pkl53.imageClass.BlokPekerja4 blokPekerja41;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel loopPanel;
    private javax.swing.JButton tambahArtButton;
    private javax.swing.JButton tambahPekerjaanButton;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the b4Keteranganumumlist
     */
    public List <B4Keteranganumumtenagakerja> getB4Keteranganumumlist() {
        return b4Keteranganumumlist;
    }

    /**
     * @param b4Keteranganumumlist the b4Keteranganumumlist to set
     */
    public void setB4Keteranganumumlist(List <B4Keteranganumumtenagakerja> b4Keteranganumumlist) {
        this.b4Keteranganumumlist = b4Keteranganumumlist;
    }

    /**
     * @return the b4ArtList
     */
    public List <B4Art> getB4ArtList() {
        return b4ArtList;
    }

    /**
     * @param b4ArtList the b4ArtList to set
     */
    public void setB4ArtList(List <B4Art> b4ArtList) {
        this.b4ArtList = b4ArtList;
    }

    /**
     * @return the kks
     */
    public String getKks() {
        return kks;
    }

    /**
     * @param kks the kks to set
     */
    public void setKks(String kks) {
        this.kks = kks;
    }
}
